package com.study.sync;

/**
 * @Author HBZ
 * @Date 2020/8/16 23:08
 * @Description
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("使用关键字synchronized");
        SyncThread1 syncThread = new SyncThread1();
        Thread thread1 = new Thread(syncThread, "SyncThread1");
        Thread thread2 = new Thread(syncThread, "SyncThread2");
//        thread1.start();
//        thread2.start();
        Thread thread3=new Thread(new SyncThread1(), "SyncThread3");
        Thread thread4=new Thread(new SyncThread1(), "SyncThread4");
        thread3.start();
        thread4.start();
    }
}
